<?php declare(strict_types=1);

/**
 *  Website: https://mudew.com/
 *  Author: Lkeme
 *  License: The MIT License
 *  Email: Useri@live.cn
 *  Updated: 2022 ~ 2023
 *
 *   _____   _   _       _   _   _   _____   _       _____   _____   _____
 *  |  _  \ | | | |     | | | | | | | ____| | |     |  _  \ | ____| |  _  \ &   ／l、
 *  | |_| | | | | |     | | | |_| | | |__   | |     | |_| | | |__   | |_| |   （ﾟ､ ｡ ７
 *  |  _  { | | | |     | | |  _  | |  __|  | |     |  ___/ |  __|  |  _  /  　 \、ﾞ ~ヽ   *
 *  | |_| | | | | |___  | | | | | | | |___  | |___  | |     | |___  | | \ \   　じしf_, )ノ
 *  |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_|     |_____| |_|  \_\
 */

namespace Bhp\Api\XLive\WebRoom\V1\Index;

use Bhp\Request\Request;

class ApiIndex
{
    /**
     * web端获取直播间信息
     * @param int $room_id
     * @return array
     */
    public static function getInfoByRoom(int $room_id): array
    {
        $url = 'https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom';
        $payload = [
            'room_id' => $room_id
        ];
        // {"code":0,"message":"0","ttl":1,"data":{"room_info":{"uid":11153765,"room_id":23058,"short_id":3,"title":"哔哩哔哩音悦台","cover":"","tags":"","background":"https://i0.hdslb.com/bfs/live/2836bb7b84c792e2c6aadfd4d1cce13484775fa3.jpg","description":"<p>这里是哔哩哔哩官方音乐台喔！</p><p>一起来听音乐吧ε=ε=(ノ≧∇≦)ノ</p><p>没想到蒸汽配圣诞下装，意外的很暴露呢=3=</p>\n","live_status":1,"live_start_time":1642502066,"live_screen_type":0,"lock_status":0,"lock_time":0,"hidden_status":0,"hidden_time":0,"area_id":190,"area_name":"唱见电台","parent_area_id":5,"parent_area_name":"电台","keyframe":"http://i0.hdslb.com/bfs/live-key-frame/keyframe060819060000000230586pqb4d.jpg","special_type":0,"up_session":"204681708782508562","pk_status":0,"is_studio":false,"pendants":{"frame":{"name":"","value":"","desc":""}},"on_voice_join":0,"online":3841,"room_type":{"2-3":0,"3-21":0}},"anchor_info":{"base_info":{"uname":"3号直播间","face":"http://i2.hdslb.com/bfs/face/5d35da6e93fbfb1a77ad6d1f1004b08413913f9a.jpg","gender":"保密","official_info":{"role":1,"title":"哔哩哔哩直播 官方账号","desc":"","is_nft":0,"nft_dmark":"https://i0.hdslb.com/bfs/live/9f176ff49d28c50e9c53ec1c3297bd1ee539b3d6.gif"}},"live_info":{"level":40,"level_color":16746162,"score":255529748,"upgrade_score":0,"current":[25000000,147013810],"next":[],"rank":">10000"},"relation_info":{"attention":247329},"medal_info":{"medal_name":"电音","medal_id":123,"fansclub":1342}},"news_info":{"uid":11153765,"ctime":"2021-09-24 12:49:50","content":"3号大歌厅是音悦台特别推出的测试栏目，23日-25日11点-23点为期3天，希望大家支持！"},"rankdb_info":{"roomid":23058,"rank_desc":"小时总榜","color":"#FB7299","h5_url":"https://live.bilibili.com/p/html/live-app-rankcurrent/index.html?is_live_half_webview=1&hybrid_half_ui=1,5,85p,70p,FFE293,0,30,100,10;2,2,320,100p,FFE293,0,30,100,0;4,2,320,100p,FFE293,0,30,100,0;6,5,65p,60p,FFE293,0,30,100,10;5,5,55p,60p,FFE293,0,30,100,10;3,5,85p,70p,FFE293,0,30,100,10;7,5,65p,60p,FFE293,0,30,100,10;&anchor_uid=11153765&rank_type=master_realtime_hour_room&area_hour=1&area_v2_id=190&area_v2_parent_id=5","web_url":"https://live.bilibili.com/blackboard/room-current-rank.html?rank_type=master_realtime_hour_room&area_hour=1&area_v2_id=190&area_v2_parent_id=5","timestamp":1654686465},"area_rank_info":{"areaRank":{"index":0,"rank":">1000"},"liveRank":{"rank":">10000"}},"battle_rank_entry_info":{"first_rank_img_url":"","rank_name":"尚无段位","show_status":1},"tab_info":{"list":[{"type":"seven-rank","desc":"高能榜","isFirst":1,"isEvent":0,"eventType":"","listType":"","apiPrefix":"","rank_name":"room_7day"},{"type":"guard","desc":"大航海","isFirst":0,"isEvent":0,"eventType":"","listType":"top-list","apiPrefix":"","rank_name":""}]},"activity_init_info":{"eventList":[],"weekInfo":{"bannerInfo":null,"giftName":null},"giftName":null,"lego":{"timestamp":1654686465,"config":"[{\"name\":\"frame-mng\",\"url\":\"https:\\/\\/live.bilibili.com\\/p\\/html\\/live-web-mng\\/index.html?roomid=#roomid#&arae_id=#area_id#&parent_area_id=#parent_area_id#&ruid=#ruid#\",\"startTime\":1559544736,\"endTime\":1877167950,\"type\":\"frame-mng\"},{\"name\":\"s10-fun\",\"target\":\"sidebar\",\"icon\":\"https:\\/\\/i0.hdslb.com\\/bfs\\/activity-plat\\/static\\/20200908\\/3435f7521efc759ae1f90eae5629a8f0\\/HpxrZ7SOT.png\",\"text\":\"\\u7545\\u73a9s10\",\"url\":\"https:\\/\\/live.bilibili.com\\/s10\\/fun\\/index.html?room_id=#roomid#&width=376&height=600&source=sidebar\",\"color\":\"#2e6fc0\",\"startTime\":1600920000,\"endTime\":1604721600,\"parentAreaId\":2,\"areaId\":86},{\"name\":\"genshin-avatar\",\"target\":\"sidebar\",\"icon\":\"https:\\/\\/i0.hdslb.com\\/bfs\\/activity-plat\\/static\\/20210721\\/fa538c98e9e32dc98919db4f2527ad02\\/qWxN1d0ACu.jpg\",\"text\":\"\\u539f\\u77f3\\u798f\\u5229\",\"url\":\"https:\\/\\/live.bilibili.com\\/activity\\/live-activity-full\\/genshin_avatar\\/mobile.html?no-jump=1&room_id=#roomid#&width=376&height=550#\\/\",\"color\":\"#2e6fc0\",\"frameAllowNoBg\":\"1\",\"frameAllowDrag\":\"1\",\"startTime\":1627012800,\"endTime\":1630425540,\"parentAreaId\":3,\"areaId\":321}]"}},"voice_join_info":{"status":{"open":0,"anchor_open":0,"status":0,"uid":0,"user_name":"","head_pic":"","guard":0,"start_at":0,"current_time":1654686465},"icons":{"icon_close":"https://i0.hdslb.com/bfs/live/a176d879dffe8de1586a5eb54c2a08a0c7d31392.png","icon_open":"https://i0.hdslb.com/bfs/live/70f0844c9a12d29db1e586485954290144534be9.png","icon_wait":"https://i0.hdslb.com/bfs/live/1049bb88f1e7afd839cc1de80e13228ccd5807e8.png","icon_starting":"https://i0.hdslb.com/bfs/live/948433d1647a0704f8216f017c406224f9fff518.gif"},"web_share_link":"https://live.bilibili.com/h5/23058"},"ad_banner_info":{"data":[{"id":152654,"title":"夏日歌谣季","location":"room_advertisement","position":3,"pic":"https://i0.hdslb.com/bfs/live/fb53a315289477790a4760561f8e348666d846d4.png","link":"https://live.bilibili.com/blackboard/activity-2WD0tBntYO.html","weight":0,"room_id":0,"up_id":0,"parent_area_id":0,"area_id":0,"live_status":0,"av_id":0,"is_ad":false,"ad_transparent_content":null,"show_ad_icon":false},{"id":153962,"title":"夏日互动派对","location":"room_advertisement","position":4,"pic":"https://i0.hdslb.com/bfs/live/71bedfcd89f065d8d4a45c8d8e88a59b45eac8c4.jpg","link":"https://www.bilibili.com/blackboard/live/activity-k1NFbOeWmt.html","weight":0,"room_id":0,"up_id":0,"parent_area_id":0,"area_id":0,"live_status":0,"av_id":0,"is_ad":false,"ad_transparent_content":null,"show_ad_icon":false},{"id":151469,"title":"万元直播奖金等你瓜分！","location":"room_advertisement","position":5,"pic":"https://i0.hdslb.com/bfs/live/c07bdf3bfd518967bb26bd23a588cce01740944c.jpg","link":"https://www.bilibili.com/blackboard/cxhsy.html","weight":0,"room_id":0,"up_id":0,"parent_area_id":0,"area_id":0,"live_status":0,"av_id":0,"is_ad":false,"ad_transparent_content":null,"show_ad_icon":false}]},"skin_info":{"id":0,"skin_name":"","skin_config":"","show_text":"","skin_url":"","start_time":0,"end_time":0,"current_time":1654686465},"web_banner_info":{"id":0,"title":"","left":"","right":"","jump_url":"","bg_color":"","hover_color":"","text_bg_color":"","text_hover_color":"","link_text":"","link_color":"","input_color":"","input_text_color":"","input_hover_color":"","input_border_color":"","input_search_color":""},"lol_info":{"lol_activity":{"status":0,"guess_cover":"http://i0.hdslb.com/bfs/live/61d1c4bcce470080a5408d6c03b7b48e0a0fa8d7.png","vote_cover":"https://i0.hdslb.com/bfs/activity-plat/static/20190930/4ae8d4def1bbff9483154866490975c2/oWyasOpox.png","vote_h5_url":"https://live.bilibili.com/p/html/live-app-wishhelp/index.html?is_live_half_webview=1&hybrid_biz=live-app-wishhelp&hybrid_rotate_d=1&hybrid_half_ui=1,3,100p,360,0c1333,0,30,100;2,2,375,100p,0c1333,0,30,100;3,3,100p,360,0c1333,0,30,100;4,2,375,100p,0c1333,0,30,100;5,3,100p,360,0c1333,0,30,100;6,3,100p,360,0c1333,0,30,100;7,3,100p,360,0c1333,0,30,100;8,3,100p,360,0c1333,0,30,100;","vote_use_h5":true}},"pk_info":null,"battle_info":null,"silent_room_info":{"type":"","level":0,"second":0,"expire_time":0},"switch_info":{"close_guard":false,"close_gift":false,"close_online":false,"close_danmaku":false},"record_switch_info":{"record_tab":false},"room_config_info":{"dm_text":"发个弹幕呗~"},"gift_memory_info":{"list":null},"new_switch_info":{"room-socket":1,"room-prop-send":1,"room-sailing":1,"room-info-popularity":1,"room-danmaku-editor":1,"room-effect":1,"room-fans_medal":1,"room-report":1,"room-feedback":1,"room-player-watermark":1,"room-recommend-live_off":1,"room-activity":1,"room-web_banner":1,"room-silver_seeds-box":1,"room-wishing_bottle":1,"room-board":1,"room-supplication":1,"room-hour_rank":1,"room-week_rank":1,"room-anchor_rank":1,"room-info-integral":1,"room-super-chat":1,"room-tab":1,"room-hot-rank":1,"fans-medal-progress":1,"gift-bay-screen":1,"room-enter":1,"room-my-idol":1,"room-topic":1,"fans-club":1},"super_chat_info":{"status":1,"jump_url":"https://live.bilibili.com/p/html/live-app-superchat2/index.html?is_live_half_webview=1&hybrid_half_ui=1,3,100p,70p,ffffff,0,30,100,12,0;2,2,375,100p,ffffff,0,30,100,0,0;3,3,100p,70p,ffffff,0,30,100,12,0;4,2,375,100p,ffffff,0,30,100,0,0;5,3,100p,60p,ffffff,0,30,100,12,0;6,3,100p,60p,ffffff,0,30,100,12,0;7,3,100p,60p,ffffff,0,30,100,12,0","icon":"https://i0.hdslb.com/bfs/live/0a9ebd72c76e9cbede9547386dd453475d4af6fe.png","ranked_mark":0,"message_list":[]},"online_gold_rank_info_v2":{"list":[{"uid":87212425,"face":"http://i0.hdslb.com/bfs/face/member/noface.jpg","uname":"我家的大懒猫","score":"129","rank":1,"guard_level":0},{"uid":6331378,"face":"http://i1.hdslb.com/bfs/face/95d0f044829772cfc871008b56a3e8543f6d846f.jpg","uname":"伊卡萌神","score":"109","rank":2,"guard_level":0},{"uid":8604164,"face":"http://i2.hdslb.com/bfs/face/87a572e9203955777a2c7b8cbb6f00b863a015e6.jpg","uname":"我太伤心了","score":"100","rank":3,"guard_level":0},{"uid":3051401,"face":"http://i2.hdslb.com/bfs/face/784c71adbfc68558f62f79b8a4e3c93a77ec52a9.jpg","uname":"百合天堂","score":"59","rank":4,"guard_level":0},{"uid":10113007,"face":"http://i1.hdslb.com/bfs/face/26a519556ea5b072a9c843f7d28fe0784bc55671.jpg","uname":"乃木坂七花骑","score":"57","rank":5,"guard_level":0},{"uid":27108173,"face":"http://i2.hdslb.com/bfs/face/30cd9328b0dea0303b633dd59fae0ffac94012a0.jpg","uname":"拍楼上柰子","score":"46","rank":6,"guard_level":0},{"uid":17256283,"face":"http://i1.hdslb.com/bfs/face/57b496ebadacf059f1475f164dabfbf918ec4189.jpg","uname":"MJ.King","score":"45","rank":7,"guard_level":0}]},"dm_emoticon_info":{"is_open_emoticon":1,"is_shield_emoticon":0},"dm_tag_info":{"dm_tag":0,"platform":[],"extra":"","dm_chronos_extra":"","dm_mode":[],"dm_setting_switch":0,"material_conf":null},"topic_info":{"topic_id":0,"topic_name":""},"game_info":{"game_status":0},"watched_show":{"switch":true,"num":1321,"text_small":"1321","text_large":"1321人看过","icon":"","icon_location":0,"icon_web":""},"topic_room_info":{"interactive_h5_url":"","watermark":1},"show_reserve_status":false,"second_create_info":{"click_permission":0},"video_connection_info":null,"player_throttle_info":{"status":1,"normal_sleep_time":1800,"fullscreen_sleep_time":3600,"tab_sleep_time":1800,"prompt_time":30},"guard_info":{"count":0,"anchor_guard_achieve_level":0},"hot_rank_info":null}}
        return Request::getJson(true, 'other', $url, $payload);
    }
}